package com.venue.hjt.venueclass.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.venue.hjt.venueclass.R;
import com.venue.hjt.venueclass.bean.GroupBean;
import com.venue.hjt.venueclass.bean.VenueChoiceBean;
import com.venue.hjt.venueclass.db.VenueGroup;

import java.util.List;

/**

 */

public class VenueOrderAdapter2 extends BaseAdapter {
    private Context mContext;
    private List<GroupBean.Data> list;
    public VenueOrderAdapter2(Context mContext, List<GroupBean.Data> list) {
        this.mContext = mContext;
        this.list = list;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHander viewHander;
        if (convertView==null){
            viewHander=new ViewHander();
            convertView= View.inflate(mContext, R.layout.venue_order_x,null);
            viewHander.tv_venue_order_x_name=convertView.findViewById(R.id.tv_venue_order_x_name);
            viewHander.ll_order_bg=convertView.findViewById(R.id.ll_order_bg);
            convertView.setTag(viewHander);
        }else{
            viewHander= (ViewHander) convertView.getTag();
        }
        if (list.get(position).isGroup){
         viewHander.ll_order_bg.setBackgroundResource(R.drawable.shape13);
        }else{
            viewHander.ll_order_bg.setBackgroundResource(R.drawable.shape5);
        }
        viewHander.tv_venue_order_x_name.setText(list.get(position).groupname);
        return convertView;
    }
    class ViewHander{
        TextView tv_venue_order_x_name;
        LinearLayout ll_order_bg;
    }

}
